<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/sortRelease.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/assembly_release.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>

<SCRIPT language="JavaScript">
window.onload = init;

function init()
{
    qs_1 = new QuickSearch(document.sortReleaseForm['sortRelease.processStepId'], document.sortReleaseForm.qs1, false);
    qs_2 = new QuickSearch(document.sortReleaseForm['sortRelease.lotNumber'], document.sortReleaseForm.qs2, false);
}

function search()
{
    document.sortReleaseForm.action = "<%=chipTracContext%>/sortRelease.do?action=search";
    document.sortReleaseForm.submit();
}

function reset()
{
    document.sortReleaseForm.reset();
    qs_1.resetQuickSearchCntrl();
    qs_2.resetQuickSearchCntrl();
}
function approveSortRelease( sortRelId )
{
    document.sortReleaseForm.action = '<%=chipTracContext%>/sortRelease.do?action=approved&sortRelId='+sortRelId;
    document.sortReleaseForm.submit();
}
function printView( sortRelId )
{
	newWindow = window.open ('<%=chipTracContext%>/sortRelease.do?action=printerFriendly&sortRelId='+sortRelId,'printerFreindlyPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
}
</SCRIPT>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
	<TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

	<!-- Side Navigation start -->
	<%@ include file="/jsp/operations/releaseMenu.jsp" %></TD>
	<!-- end of the side navigations -->

	<TD bgcolor="#ffffff">
	<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
	<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
	<TD valign="top" width="100%">

	<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
	<BR>

	<html:form action="/sortRelease.do" method="POST" onsubmit="javascript:return search();" type="com.scalar.chiptrack.operations.release.forms.SortReleaseForm">
    <nested:nest property="sortRelease" >
		<TABLE width="91%" align="center" cellpadding="2" cellspacing="2" border="0">
			<TR><TD colspan="4" class="NArialW" align="center">Wafer Sort Release</TD></TR>

			<TR><TD colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:errors styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4' class="NArialL"><chiptrack:info styleClass="NArialL"/></TD></TR>
			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr>
            <td class="NArialL">
            Quick Search Lot Number:
            </td>
            <td class="NArialL">
            <input type="text" name="qs2" class="txfield" size='12' onkeyup='quickSearch(qs_2)'/>
            </td>
            <td class="NArialL" width='30%'>
            Quick Search Part Number:
            </td>
            <td class="NArialL" width='20%'>
            <input type="text" name="qs1" class="txfield" size='12' onkeyup='quickSearch(qs_1)'/>
            </td>
            </tr>
			<tr>
			<td class="NArialL">
			Lot Number:
			</td>
			<td class="NArialL">
			<nested:select property="lotNumber"  styleClass="txfield">
				<html:option value="-1">All</html:option>
                <logic:present name="lotNumbers">
                    <html:options collection="lotNumbers" property="value" labelProperty="label"/>
                </logic:present>
            </nested:select>
			</td>
            <td class="NArialL">
            Part Number:
            </td>
            <td class="NArialL">
            <nested:select property="processStepId"  styleClass="txfield">
                <html:option value="-1">All</html:option>
                <html:options collection="partNumberList" property="value" labelProperty="label"/>
            </nested:select>
            </td>
			</tr>

            <tr>
            <td class="NArialL">
			Vendor:
			</td>
			<td class="NArialL">
			<nested:select property="vendorId"  styleClass="txfield">
				<html:option value="-1">All</html:option>
				<html:options collection="toLocationList" property="value" labelProperty="label"/>
			</nested:select>
			</td>
            <td class="NArialL">
            Status:
            </td>
            <td class="NArialL">
            <nested:select property="status"  styleClass="txfield">
                <html:option value="-1">All</html:option>
                <html:options collection="statusList" property="value" labelProperty="label"/>
            </nested:select>
            </td>
            </tr>
			<tr>
			<td class="NArialL">
			Year:
			</td>
			<td class="NArialL">
			<nested:select property="year"  styleClass="txfield">
				<html:option value="-1">All</html:option>
				<html:options collection="yearList" property="value" labelProperty="label"/>
			</nested:select>
			</td>
                <TD COLSPAN='2'/>
            </tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
			<tr>
				<td colspan="4" align="center">
                 <input type=image border="0" onclick="javascript:search()" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Wafer Sort Release';return true" onmouseout="window.status='';return true" title="Click here to Search for Wafer Sort Release">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
				</td>
			</tr>
			<tr><td colspan='4' class="NArialL">
            Please <chiptrack:restrictedLink functionality='<%=Functionality.SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext+"/sortRelease.do?action=new"%>'
                                onmouseover="window.status='Click to Create Sort Release';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink> to generate new Wafer Sort Release</tr></td>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <logic:present name="sortReleaseList" scope="request">
            <TR>
                <TD colspan='4'>
                    <table width="100%" align="left" cellpadding="2" cellspacing="2" border="0">
                        <tr>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Sort Rel Number</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Vendor Name</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Part Number</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Lot Number</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Release Date</font>
                            </td>
                            <td width="15%" class="NArialL" bgcolor="#993333" align="center">
                                <font color="#FFFFFF">Status</font>
                            </td>
                            <td width="25%" class="NArialL" bgcolor="#993333" align="center">
                               <font color="#FFFFFF"> Actions</font>
                            </td>
                        </tr>
                        <logic:iterate name="sortReleaseList" id="sortRelease" type="com.scalar.chiptrack.operations.release.SortRelease" indexId="iteratorIdx" >

                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                <td class="NArialL">
                                    <bean:write name="sortRelease" property="sortRelNumber" />
                                </td>
                                <td class="NArialL">
                                    <bean:write name="sortRelease" property="vendName" />
                                </td>
                                <td  class="NArialL">
                                    <bean:write name="sortRelease" property="partNumber" />
                                </td>
                                <td class="NArialL">
                                    <bean:write name="sortRelease" property="lotNumber" />
                                </td>
                                <td class="NArialL">
                                    <bean:write name="sortRelease" property="sortRelDate" />
                                </td>
                                <td class="NArialL">
                                    <bean:write name="sortRelease" property="status"/>
                                </td>


                                <td class="NArialL" align="center" NOWRAP>

									<!-- BR Jun 23 2005 ---- START -->

                                    <logic:notEqual name="sortRelease" property="status" value='Cancelled'>
                                        <logic:notEqual name="sortRelease" property="status" value='Closed'>
                                            <a href='<%=chipTracContext%>/sortRelease.do?action=view&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to View Sort Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;

                                            <a href='<%=chipTracContext%>/sortRelease.do?action=modify&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to Modify Sort Release';return true" onMouseout="window.status='';return ">Modify</a>&nbsp;&nbsp;&nbsp;

                                            <logic:notEqual name="sortRelease" property="status" value='Approved'>
                                                <a href='<%=chipTracContext%>/sortRelease.do?action=approved&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to Approve Sort Release';return true" onMouseout="window.status='';return ">Approve</a>&nbsp;&nbsp;&nbsp;
                                            </logic:notEqual>

                                            <logic:equal name="sortRelease" property="status" value='Approved'>
                                                Approve&nbsp;&nbsp;&nbsp;
                                            </logic:equal>
                                            <a href='<%=chipTracContext%>/sortRelease.do?action=cancel&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to cancel this Sort Release';return true" onMouseout="window.status='';return ">Cancel</a>&nbsp;&nbsp;&nbsp;
                                            <a href='<%=chipTracContext%>/sortRelease.do?action=close&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to cancel this Sort Release';return true" onMouseout="window.status='';return ">Close</a>&nbsp;&nbsp;&nbsp;
                                       </logic:notEqual>

                                    </logic:notEqual>
                                    <!-- BR Jun 23 2005 ---- END -->
                                    <logic:equal name="sortRelease" property="status" value='Cancelled'>
	                                    <a href='<%=chipTracContext%>/sortRelease.do?action=view&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to View Sort Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                        Modify&nbsp;&nbsp;&nbsp;Approve&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                    </logic:equal>
                                    <logic:equal name="sortRelease" property="status" value='Closed'>
	                                    <a href='<%=chipTracContext%>/sortRelease.do?action=view&sortRelId=<bean:write name="sortRelease" property="sortRelId" />' onMouseOver="window.status='Click to View Sort Release';return true" onMouseout="window.status='';return ">View</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                        Modify&nbsp;&nbsp;&nbsp;Approve&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;
                                    </logic:equal>

                                </td>
                            </tr>
                        </logic:iterate>

                    </table>
                </TD>
           </TR>
           </logic:present>
		</TABLE>
    </nested:nest>
	</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>